﻿
namespace MVVMAppPerformanceimprovement
{
    using System.ComponentModel;
    using System.Threading;

    class MainWindowViewModel : INotifyPropertyChanged
    {
        string _message1 = "Message1";
        public string Message1
        {
            get
            {
                Thread.Sleep(7000);
                return _message1; 
            }
            set
            {
                _message1 = value;
                OnPropertyChanged("Message1");
            }
        }

        string _message2 = "Message2";
        public string Message2
        {
            get 
            {
                Thread.Sleep(3000);
                return _message2; 
            }
            set
            {
                _message2 = value;
                OnPropertyChanged("Message2");
            }
        }

        #region INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this,
                    new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
        
    }
}
